home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE23
/
STARTUP
/
StubDll32.dpr
< prev
next >
Wrap
Text File
|
1997-04-27
|
1KB
|
42 lines
library StubDll32;
{$ifndef WIN32}
'This needs Delphi 32'
{$endif}
uses
Windows,
SysUtils,
StubDll32U in 'StubDll32U.pas';
{ Note that dll_Thread_Detach uses WriteConsole instead of WriteLn }
{ This is because WriteLn mysteriously crashes the program if used there }
procedure DLLEntryPoint(dwReason: DWord);
const
DetachText: String = 'DLL: DLLEntryPoint(dll_Thread_Detach)'#13#10;
var
CharsWritten: DWord;
begin
case dwReason of
dll_Process_Attach:
WriteLn('DLL: DLLEntryPoint(dll_Process_Attach)');
dll_Thread_Attach:
WriteLn('DLL: DLLEntryPoint(dll_Thread_Attach)');
dll_Thread_Detach:
WriteConsole(TTextRec(Output).Handle, PChar(DetachText),
Length(DetachText), CharsWritten, nil);
dll_Process_Detach:
WriteLn('DLL: DLLEntryPoint(dll_Process_Detach)');
end;
end;
begin
WriteLn('DLL: Main program block');
if IsLibrary then
begin
// Set up the DLLEntryPoint routine
DllProc := @DLLEntryPoint;
// Call it for process attachment (it won't happen automatically)
DLLEntryPoint(dll_Process_Attach);
end;
end.